<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>20.input输入框监听</title>
  <style>
    *{
      padding: 0;
      margin: 0;
    }
    body{
      background-color: rgb(142, 245, 173);
    }
    .content{
      background-color: #fff;
      width: 30%;
      height: 500px;
      margin: 100px auto;
      border: 1px solid #000;
      border-radius: 5px;
      text-align: center;
    }
    .inp{
      width: 510px;
      padding-bottom: 100px;
      margin-top: 10px;
    }
    .text{

    }
  </style>
</head>
<script src="js/jquery-1.12.4.min.js"></script>
<script>
  $(function(){
    $('.btn').click(function(){
      var text = $('input').val();
      console.log('text', text);
    });

    $('body').delegate("")
  });
</script>
<body>
  <div class="content">
    <input class="inp" type="text">
    <div class="text"></div>
    <button class="btn">按钮</button>
  </div>
</body>
</html>